This document displays populations of top 10 cities in Latvia in a barchart using plotly.
The data came from: Latvia Cities Database at simplemaps.com.
df <- read.csv('cities_in_latvia.csv')
head(df)
## city lat lng country iso2 admin_name capital population
## 1 Riga 56.9489 24.1064 Latvia LV Rīga primary 920643
## 2 Daugavpils 55.8750 26.5356 Latvia LV Augšdaugava admin 80627
## 3 Liepāja 56.5117 21.0139 Latvia LV Liepāja admin 67964
## 4 Jelgava 56.6483 23.7139 Latvia LV Jelgava admin 55336
## 5 Jūrmala 56.9681 23.7703 Latvia LV Jūrmala admin 50561
## 6 Ventspils 57.3906 21.5733 Latvia LV Ventspils admin 33372
## population_proper
## 1 605802
## 2 79120
## 3 67360
## 4 54694
## 5 50561
## 6 32955
subdf <- head(select(df, city, population), 10)
plot_ly(x=subdf$city, y=subdf$population, type="bar")